/**
 * File: cs3343-Satir-Therapy/src/program/SatirTherapy.java
 *  
 * Responsible author: Lai Hing Hung, Dennis					Revision no: 1.0.0
 * Checked in at date: 2012/02/01 12:00
 * Checked out at date: 2012/02/03 11:54
 * Log: initialize the main flow of game program, displayMainMenu()
 * 
 * Responsible auther: Lai Hing Hung, Dennis					Revision no: 1.1.0
 * Checked in at date: 2012/02/05
 * Checked out at date: 2012/02/12 15:30 
 * Log: The board drawing is assigned to Board class
 * 
 * Responsible author: Lai Hing Hung, Dennis					Revision no: 1.2.0
 * Checked in at date: 2012/02/12 15:44
 * Checked out at date: 2012/02/13 20:10
 * Log: rename GameMain.java into SatirTherapy.java
 *
 * Responsible author: Lai Hing Hung, Dennis					Revision no: 1.3.0
 * Checked in at date: 2012/02/13 22:38
 * Checked out at date: 2012/02/15 21:33
 * Log: implement selection menu on startup like number of players, input of player name
 * 
 * Responsible author: Lai Hing Hung, Dennis					Revision no: 1.4.0
 * Checked in at date: 2012/02/15 22:11
 * Checked out at date: 2012/02/21 22:19
 * Log: implement menu option 1 (roll a dice) and menu option 2 (skip the turn to the next player)
 * 
 * Responsible author: Lai Hing Hung, Dennis					Revision no: 1.5.0
 * Checked in at date: 2012/02/28 09:51
 * Checked out at date: 2012/03/05 20:48
 * Log: use vector to hold players, remove option 2 - skip the turn to the next player, 
 *      simulate rolling dice, confine random number in the range of 1 - 5
 *      add save game function and load game function
 *      
 * Responsible author: Lai Hing Hung, Dennis					Revision no: 1.6.0
 * Checked in at date: 2012/04/06 16:52
 * Log: extract the previous implementation into GamePage class, retain the function of reading record
 * 		include GamePage object's method of updatePage and displayCardInfo
 * 		remove boolean variable keepOn
 * 		add turn variable to decide which player will involve in the game
 * 		add round variable to hold the total round number
 */
package program;

public class SatirTherapy {

	/**
	 * @param args
	 */
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub		
	
		// create GamePage object to display the screen
		GamePage gamePage = new GamePage();
		// initialize turn number to 1
		int turn=1;
		
		int round;
		
		// if the user starts a new game, initialize the round number to 1
		if(gamePage.getLoadedRoundNo().isEmpty()){
			round = 1;
		}
		else{ // if the user loads the previous game, restore the round number
			round = Integer.parseInt(gamePage.getLoadedRoundNo());
		}
		
		while(true){			
			// Update the game screen
			gamePage.updatePage(turn, round);
			
			// increment the turn of the game
			turn++;
			
			// when the turn number exceeds the number of players, revert the turn number to the first one!
			if(turn>gamePage.getNumberOfPlayer()){
				turn=1;
				round++;
			}
		}
	}
}
